﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TEST0406
{
    class Account
    {
        public double balance;
        //默认金额  无参
        public Account()
        {
            balance = 1000;
        }

        //指定金额  有参
        public Account(double Balance)
        {
            this.balance = Balance;
        }


        //存钱
        public void save()
        {
            Console.WriteLine("是否需要存钱\n请用“Y”代表是，“N”代表否");
            string issa = Console.ReadLine();
            if (issa == "Y" || issa == "y")
            {
                Console.WriteLine("存入金额");
                double sa = Convert.ToDouble(Console.ReadLine());
                balance += sa;
            }

        }
        //取钱
        public void draw()
        {
            Console.WriteLine("是否需要取钱\n请用“Y”代表是，“N”代表否");
            string isdr = Console.ReadLine();
            if (isdr == "Y" || isdr == "y")
            {
                Console.WriteLine("取出金额");
                double dr = Convert.ToDouble(Console.ReadLine());
                balance -= dr;
            }

        }
        //查看余额
        public void check()
        {
            Console.WriteLine("您现在所剩的余额为" + balance);

        }
    }
}
